package first;

import java.io.*;

public class RegisterBean {
    private String  username;
    private String  password;
    private String  postbox;
    private String  fname;
    private String  sname;
    private String  department;
    private String  object;
    private  String url;

    public RegisterBean() {}

    public String getUsername(){
        return username;
    }

    public void setUsername(String username){
        this.username=username;
    }

    public String getPassword(){
        return username;
    }

    public void setPassword(String password){
        this.password=password;
    }

    public boolean Write(String username,String password){

        //File fwrite = new File("Student.txt");
        int flag=0;
        try {
            Writer out =new FileWriter("Student.txt",true);
            BufferedWriter bufferWrite =new BufferedWriter(out);
            String str=username+","+password+","+""+","+""+","+""+","+""+","+""+","+"t3.jpg";
            bufferWrite.write(str);
            bufferWrite.newLine();
            flag=1;

            /*String[] massege;
            while((str=bufferWrite.readLine())!=null){
                massege=str.split(",");
                if(massege[0].equals(username)&&massege[1].equals(password)){
                    flag=1;
                    break;
                }
            }*/
            bufferWrite.close();
            out.close();
        }
        catch(IOException e){
            System.out.println(e.toString());
        }

        if(flag==1) {
            return true;
        }
        else return false;

    }

}
